import api from '@/http/api.js'
export default{
    namespaced:true,
    state:{
       rows:[],
       pages:0,
       total:0
    },
    mutations:{
           SET_SUB(state,payload){
               Object.assign(state,payload)
           }
    },
    actions:{
      async getClassById(context,payload){
           const {data}= await api.classes.getClassById(payload)
           console.log(data);
           if(data.code){
                context.commit('SET_SUB',data.data)
           }
        },
      async getAllClass(context,payload){
           const {data}= await api.classes.getAllClass(payload)
           console.log(data);
           if(data.code){
                context.commit('SET_SUB',data.data)
           }
        },
        async delClass(context,payload){
          const {data}= await api.classes.delClass(payload)
               return data
        },
        async addClass(context,payload){
          const {data}= await api.classes.addClass(payload)
               return data
        }

    }
}